home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / updates / update21.zoo / libg++ / src / diffsrc < prev    next >
Encoding:
Text File  |  1992-06-03  |  50.4 KB  |  2,213 lines

  1. *** 1.2    1992/04/19 17:18:59
  2. --- PatchLev.h    1992/06/03 13:59:56
  3. ***************
  4. *** 1,5 ****
  5.   
  6. ! #define    PatchLevel "07"
  7.   
  8.   /*
  9.    *    the Patch Level above is to identify the version
  10. --- 1,5 ----
  11.   
  12. ! #define    PatchLevel "11"
  13.   
  14.   /*
  15.    *    the Patch Level above is to identify the version
  16. *** 1.1    1992/03/22 07:42:32
  17. --- dtoa.cc    1992/06/03 13:59:58
  18. ***************
  19. *** 30,35 ****
  20. --- 30,37 ----
  21.   #define M_LN10        2.30258509299404568402
  22.   #endif
  23.   
  24. + // OBSOLETE ROUTINE!
  25.   char* dtoa(double fpnum,  char cvt, int width, int prec)
  26.   {
  27.     // set up workspace
  28. *** 1.1    1992/03/22 07:42:32
  29. --- editbuf.cc    1992/06/03 13:59:59
  30. ***************
  31. *** 15,22 ****
  32.   //    License along with this library; if not, write to the Free
  33.   //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  34.   
  35. ! #include "ioprivat.h"
  36. ! #include "editbuf.h"
  37.   #include <stddef.h>
  38.   #ifdef __GNUG__
  39.   #pragma implementation
  40. --- 15,22 ----
  41.   //    License along with this library; if not, write to the Free
  42.   //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  43.   
  44. ! #include <ioprivat.h>
  45. ! #include <editbuf.h>
  46.   #include <stddef.h>
  47.   #ifdef __GNUG__
  48.   #pragma implementation
  49. *** 1.1    1992/03/22 07:42:32
  50. --- error.cc    1992/06/03 13:59:59
  51. ***************
  52. *** 19,24 ****
  53. --- 19,25 ----
  54.   #pragma implementation
  55.   #endif
  56.   #include <builtin.h>
  57. + #include <osfcn.h>
  58.   
  59.   _VOLATILE_VOID default_one_arg_error_handler(const char* msg)
  60.   {
  61. *** 1.1    1992/03/22 07:42:32
  62. --- fstream.cc    1992/06/03 14:00:00
  63. ***************
  64. *** 16,22 ****
  65.   //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  66.   
  67.   #define _STREAM_COMPAT
  68. ! #include "ioprivat.h"
  69.   #include <fstream.h>
  70.   #ifdef __GNUG__
  71.   #pragma implementation
  72. --- 16,22 ----
  73.   //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  74.   
  75.   #define _STREAM_COMPAT
  76. ! #include <ioprivat.h>
  77.   #include <fstream.h>
  78.   #ifdef __GNUG__
  79.   #pragma implementation
  80. *** 1.1    1992/03/22 07:42:32
  81. --- ident.c    1992/06/03 14:00:01
  82. ***************
  83. *** 1,2 ****
  84. ! #include "PatchLev.h"
  85.   static char Ident[] = "$Patchlevel: " PatchLevel " $";
  86. --- 1,2 ----
  87. ! #include <PatchLev.h>
  88.   static char Ident[] = "$Patchlevel: " PatchLevel " $";
  89. *** 1.1    1992/03/22 07:42:32
  90. --- igetline.cc    1992/06/03 14:00:01
  91. ***************
  92. *** 15,21 ****
  93.   //    License along with this library; if not, write to the Free
  94.   //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  95.   
  96. ! #include "iostream.h"
  97.   
  98.   istream& istream::getline(char* buf, int len, char delim)
  99.   {
  100. --- 15,21 ----
  101.   //    License along with this library; if not, write to the Free
  102.   //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  103.   
  104. ! #include <iostream.h>
  105.   
  106.   istream& istream::getline(char* buf, int len, char delim)
  107.   {
  108. *** 1.1    1992/03/22 07:42:32
  109. --- makebuf.cc    1992/06/03 14:00:02
  110. ***************
  111. *** 21,28 ****
  112.   static char sccsid[] = "%W% (Berkeley) %G%";
  113.   #endif /* LIBC_SCCS and not lint */
  114.   
  115. ! #include "ioprivat.h"
  116. ! #include "fstream.h"
  117.   #include <sys/types.h>
  118.   #include <sys/stat.h>
  119.   
  120. --- 21,28 ----
  121.   static char sccsid[] = "%W% (Berkeley) %G%";
  122.   #endif /* LIBC_SCCS and not lint */
  123.   
  124. ! #include <ioprivat.h>
  125. ! #include <fstream.h>
  126.   #include <sys/types.h>
  127.   #include <sys/stat.h>
  128.   
  129. ***************
  130. *** 32,37 ****
  131. --- 32,41 ----
  132.   #define BUFSIZ __DEFAULT_BUFSIZ__
  133.   #endif
  134.   
  135. + #ifndef S_ISCHR
  136. + #  define S_ISCHR(X) (((X) & S_IFMT) == S_IFCHR)
  137. + #endif
  138.   /*
  139.    * Allocate a file buffer, or switch to unbuffered I/O.
  140.    * Per the ANSI C standard, ALL tty devices default to line buffered.
  141. ***************
  142. *** 41,50 ****
  143.    */
  144.   int filebuf::doallocate()
  145.   {
  146. -     if (unbuffered()) {
  147. -     setb(_fb._shortbuf, _fb._shortbuf+1, 0);
  148. -     return 1;
  149. -     }
  150.       register size_t size, couldbetty;
  151.       register char *p;
  152.       struct stat st;
  153. --- 45,50 ----
  154. ***************
  155. *** 51,67 ****
  156.   
  157.       if (fd() < 0 || _fstat(fd(), &st) < 0) {
  158.       couldbetty = 0;
  159. !     size = BUFSIZ;
  160.   #if 0
  161.       /* do not try to optimise fseek() */
  162.       fp->_flags |= __SNPT;
  163.   #endif
  164.       } else {
  165. !     couldbetty = (st.st_mode & S_IFMT) == S_IFCHR;
  166. ! #if defined(atarist) || defined(NO_ST_BLKSIZE)
  167. !     size = BUFSIZ;
  168.   #else
  169. !     size = st.st_blksize <= 0 ? BUFSIZ : st.st_blksize;
  170.   #endif
  171.       }
  172.   #ifdef USE_MALLOC_BUF
  173. --- 51,67 ----
  174.   
  175.       if (fd() < 0 || _fstat(fd(), &st) < 0) {
  176.       couldbetty = 0;
  177. !     size = _G_BUFSIZ;
  178.   #if 0
  179.       /* do not try to optimise fseek() */
  180.       fp->_flags |= __SNPT;
  181.   #endif
  182.       } else {
  183. !     couldbetty = S_ISCHR(st.st_mode);
  184. ! #if (!defined(atarist)) && _G_HAVE_ST_BLKSIZE
  185. !     size = st.st_blksize <= 0 ? _G_BUFSIZ : st.st_blksize;
  186.   #else
  187. !     size = _G_BUFSIZ;
  188.   #endif
  189.       }
  190.   #ifdef USE_MALLOC_BUF
  191. *** 1.1    1992/03/22 21:19:02
  192. --- makefile.32    1992/06/03 14:00:03
  193. ***************
  194. *** 10,32 ****
  195.   GXXLIB = $(LIB)
  196.   
  197.   # common subset of options; no int size or omit-frame-pointer:
  198. ! COMMONOPT = -O
  199.   COMMONFLAGS =
  200. ! COMMONDEFINES = -DNO_LIBGXX_MALLOC
  201.   
  202.   COPTS= $(COMMONOPT) $(COMMONFLAGS) $(COMMONDEFINES)  \
  203. !        -fstrength-reduce -DNDEBUG $(XFLAGS)
  204.   
  205.   GXXOPTS= $(COMMONOPT) $(COMMONFLAGS) $(COMMONDEFINES)  \
  206. !        -felide-constructors -fsave-memoized $(XXFLAGS) -I$(GXXINC)
  207.   
  208.   # Base options CC; includes int size but not omit-frame-pointer
  209.   CFFLAGS = $(COPTS)
  210. ! GXXFFLAGS = $(GXXOPTS)
  211.   
  212.   # normal CFLAGS including int size and omit-frame-pointer
  213. ! CFLAGS= $(CFFLAGS)
  214. ! GXXFLAGS = $(GXXFFLAGS)
  215.   
  216.   # cflags for stuff that needs to be compiled with 32 bit ints
  217.   CLFLAGS= $(CFLAGS)
  218. --- 10,34 ----
  219.   GXXLIB = $(LIB)
  220.   
  221.   # common subset of options; no int size or omit-frame-pointer:
  222. ! COMMONOPT = -O2 -fstrength-reduce
  223.   COMMONFLAGS =
  224. ! COMMONDEFINES = -DNO_LIBGXX_MALLOC -DNDEBUG
  225.   
  226.   COPTS= $(COMMONOPT) $(COMMONFLAGS) $(COMMONDEFINES)  \
  227. !        $(XFLAGS)
  228.   
  229. + # dont know why but -fsave-memoized gives false errors
  230. + # about access to protected members
  231.   GXXOPTS= $(COMMONOPT) $(COMMONFLAGS) $(COMMONDEFINES)  \
  232. !        -felide-constructors  $(XXFLAGS) -I$(GXXINC)
  233.   
  234.   # Base options CC; includes int size but not omit-frame-pointer
  235.   CFFLAGS = $(COPTS)
  236. ! GXXFFLAGS = $(GXXOPTS) 
  237.   
  238.   # normal CFLAGS including int size and omit-frame-pointer
  239. ! CFLAGS= $(CFFLAGS) -fomit-frame-pointer
  240. ! GXXFLAGS = $(GXXFFLAGS) -fomit-frame-pointer
  241.   
  242.   # cflags for stuff that needs to be compiled with 32 bit ints
  243.   CLFLAGS= $(CFLAGS)
  244. ***************
  245. *** 36,42 ****
  246.   ASFLAGS= -c
  247.   
  248.   # pre-processor flags
  249. ! PPFLAGS= -P -DNDEBUG
  250.   
  251.   # library targets
  252.   LIBG++= g++.olb
  253. --- 38,44 ----
  254.   ASFLAGS= -c
  255.   
  256.   # pre-processor flags
  257. ! PPFLAGS= -P # -DNDEBUG
  258.   
  259.   # library targets
  260.   LIBG++= g++.olb
  261. *** 1.1    1992/03/22 21:19:02
  262. --- mincl    1992/06/03 14:00:03
  263. ***************
  264. *** 13,26 ****
  265.   xgeom.cc xgetopt.cc xhypgeom.cc xinteger.cc  xlognorm.cc xmlcg.cc \
  266.   xnegexp.cc xnormal.cc xobstack.cc xpoisson.cc xrandom.cc xrationa.cc \
  267.   xregex.cc xrndint.cc xrng.cc xsmplhis.cc xsmplsta.cc \
  268. ! xstring.cc xuniform.cc xweibull.cc xyzzy.cc xeh.cc
  269.   
  270.   IOSRC = editbuf.cc filebuf.cc fstream.cc igetline.cc indstrea.cc iostream.cc \
  271.   makebuf.cc parsestr.cc sbufvfor.cc sbufvsca.cc sgetline.cc stdstrbu.cc \
  272. ! stdstrea.cc stream.cc streambu.cc strstrea.cc xplotfil.cc xsfile.cc
  273.   
  274. ! OBJ = gnulib3.o  _bin_del.o _bin_new.o _bin_nw.o ident.o\
  275. ! $(LIBSRC:.cc=.o) $(IOSRC:.cc=.o)
  276.   
  277.   all: $(ALL)
  278.   all020: $(ALL020)
  279. --- 13,31 ----
  280.   xgeom.cc xgetopt.cc xhypgeom.cc xinteger.cc  xlognorm.cc xmlcg.cc \
  281.   xnegexp.cc xnormal.cc xobstack.cc xpoisson.cc xrandom.cc xrationa.cc \
  282.   xregex.cc xrndint.cc xrng.cc xsmplhis.cc xsmplsta.cc \
  283. ! xstring.cc xuniform.cc xweibull.cc xeh.cc
  284.   
  285.   IOSRC = editbuf.cc filebuf.cc fstream.cc igetline.cc indstrea.cc iostream.cc \
  286.   makebuf.cc parsestr.cc sbufvfor.cc sbufvsca.cc sgetline.cc stdstrbu.cc \
  287. ! stdstrea.cc stream.cc streambu.cc strstrea.cc xplotfil.cc xsfile.cc \
  288. ! igetsb.cc
  289.   
  290. ! #
  291. ! # NOTE:: dummy.o MUST be the last object on this list. otherwise you'll
  292. ! #        end up with multiple definitions of global ctor/dtors
  293. ! #
  294. ! OBJ = gnulib3.o  _bin_del.o _bin_new.o _bin_nw.o ident.o \
  295. ! $(LIBSRC:.cc=.o) $(IOSRC:.cc=.o) dummy.o
  296.   
  297.   all: $(ALL)
  298.   all020: $(ALL020)
  299. *** 1.1    1992/03/22 07:42:32
  300. --- new.cc    1992/06/03 14:00:04
  301. ***************
  302. *** 1,5 ****
  303. - #ifndef NO_LIBGXX_MALLOC
  304.   // This may look like C code, but it is really -*- C++ -*-
  305.   
  306.   /* 
  307. --- 1,3 ----
  308. ***************
  309. *** 22,34 ****
  310.   #ifdef __GNUG__
  311.   #pragma implementation
  312.   #endif
  313. ! #include <stddef.h>
  314. ! #include <stdlib.h>
  315.   
  316.   void* operator new(size_t n) 
  317.   {
  318.     return malloc (n);
  319.   }
  320.   #endif
  321. --- 20,31 ----
  322.   #ifdef __GNUG__
  323.   #pragma implementation
  324.   #endif
  325. ! #include <new.h>
  326. ! #if 0 /* ndef NO_LIBGXX_MALLOC */
  327.   
  328.   void* operator new(size_t n) 
  329.   {
  330.     return malloc (n);
  331.   }
  332.   #endif
  333. *** 1.1    1992/03/22 07:42:32
  334. --- parsestr.cc    1992/06/03 14:00:04
  335. ***************
  336. *** 18,25 ****
  337.   #ifdef __GNUG__
  338.   #pragma implementation
  339.   #endif
  340. ! #include "ioprivat.h"
  341. ! #include "parsestr.h"
  342.   
  343.   streambuf* parsebuf::setbuf(char*, size_t)
  344.   {
  345. --- 18,25 ----
  346.   #ifdef __GNUG__
  347.   #pragma implementation
  348.   #endif
  349. ! #include <ioprivat.h>
  350. ! #include <parsestr.h>
  351.   
  352.   streambuf* parsebuf::setbuf(char*, size_t)
  353.   {
  354. *** 1.1    1992/03/22 07:42:32
  355. --- regex.cc    1992/06/03 14:00:05
  356. ***************
  357. *** 45,60 ****
  358.   /* The `emacs' switch turns on certain special matching commands
  359.     that make sense only in emacs. */
  360.   
  361. ! #include "config.h"
  362. ! #include "lisp.h"
  363. ! #include "buffer.h"
  364. ! #include "syntax.h"
  365.   
  366.   #else  /* not emacs */
  367.   
  368.   #include <string.h>
  369.   
  370. ! #if defined (USG) || defined (STDC_HEADERS)
  371.   #if !(defined(BSTRING) || defined(atarist))
  372.   #define bcopy(s,d,n)    memcpy((d),(s),(n))
  373.   #define bcmp(s1,s2,n)    memcmp((s1),(s2),(n))
  374. --- 45,61 ----
  375.   /* The `emacs' switch turns on certain special matching commands
  376.     that make sense only in emacs. */
  377.   
  378. ! #include <config.h>
  379. ! #include <lisp.h>
  380. ! #include <buffer.h>
  381. ! #include <syntax.h>
  382.   
  383.   #else  /* not emacs */
  384.   
  385.   #include <string.h>
  386. + #include <g_config.h>
  387.   
  388. ! #if defined (_G_SYSV) || defined (STDC_HEADERS)
  389.   #if !(defined(BSTRING) || defined(atarist))
  390.   #define bcopy(s,d,n)    memcpy((d),(s),(n))
  391.   #define bcmp(s1,s2,n)    memcmp((s1),(s2),(n))
  392. ***************
  393. *** 121,127 ****
  394.   #endif
  395.   
  396.   /* Get the interface, including the syntax bits.  */
  397. ! #include "regex.h"
  398.   
  399.   
  400.   /* These are the command codes that appear in compiled regular
  401. --- 122,128 ----
  402.   #endif
  403.   
  404.   /* Get the interface, including the syntax bits.  */
  405. ! #include <regex.h>
  406.   
  407.   
  408.   /* These are the command codes that appear in compiled regular
  409. ***************
  410. *** 220,232 ****
  411.   #define NFAILURES 80
  412.   #endif
  413.   
  414. ! #ifdef CHAR_UNSIGNED
  415. ! #define SIGN_EXTEND_CHAR(c) ((c)>(char)127?(c)-256:(c)) /* for IBM RT */
  416. ! #endif
  417.   #ifndef SIGN_EXTEND_CHAR
  418. ! #define SIGN_EXTEND_CHAR(x) (x)
  419.   #endif
  420. !  
  421.   
  422.   /* Store NUMBER in two contiguous bytes starting at DESTINATION.  */
  423.   #define STORE_NUMBER(destination, number)                \
  424. --- 221,234 ----
  425.   #define NFAILURES 80
  426.   #endif
  427.   
  428.   #ifndef SIGN_EXTEND_CHAR
  429. ! #ifdef __STDC__
  430. ! #define SIGN_EXTEND_CHAR(c) ((signed char)(c))
  431. ! #else
  432. ! #define SIGN_EXTEND_CHAR(c) (((c)^128) - 128) /* As in Harbison and Steele.  */
  433.   #endif
  434. ! #endif /* not SIGN_EXTEND_CHAR */
  435.   
  436.   /* Store NUMBER in two contiguous bytes starting at DESTINATION.  */
  437.   #define STORE_NUMBER(destination, number)                \
  438. ***************
  439. *** 2637,2643 ****
  440.   
  441.   #ifdef canned
  442.   
  443. ! #include "tests.h"
  444.   
  445.   typedef enum { extended_test, basic_test } test_type;
  446.   
  447. --- 2639,2645 ----
  448.   
  449.   #ifdef canned
  450.   
  451. ! #include <tests.h>
  452.   
  453.   typedef enum { extended_test, basic_test } test_type;
  454.   
  455. *** 1.1    1992/03/22 07:42:32
  456. --- sbufvfor.cc    1992/06/03 14:00:05
  457. ***************
  458. *** 27,39 ****
  459.    */
  460.   
  461.   #include <sys/types.h>
  462. ! #include "ioprivat.h"
  463.   #include <string.h>
  464. - #if __STDC__
  465.   #include <stdarg.h>
  466. - #else
  467. - #include <varargs.h>
  468. - #endif
  469.   
  470.   /*
  471.    * Define FLOATING_POINT to get floating point.
  472. --- 27,35 ----
  473.    */
  474.   
  475.   #include <sys/types.h>
  476. ! #include <ioprivat.h>
  477.   #include <string.h>
  478.   #include <stdarg.h>
  479.   
  480.   /*
  481.    * Define FLOATING_POINT to get floating point.
  482. ***************
  483. *** 51,57 ****
  484.    * worries about ungetc buffers and so forth.
  485.    */
  486.   
  487. ! class help_streambuf : public streambuf {
  488.     public:
  489.       char *buffer;
  490.       size_t buf_size;
  491. --- 47,53 ----
  492.    * worries about ungetc buffers and so forth.
  493.    */
  494.   
  495. ! class help_streambuf : public backupbuf {
  496.     public:
  497.       char *buffer;
  498.       size_t buf_size;
  499. ***************
  500. *** 85,98 ****
  501.   
  502.   int help_vform(streambuf *sb, char const *fmt0, va_list ap)
  503.   {
  504. !     char buf[BUFSIZ];
  505. !     help_streambuf helper(sb, buf, BUFSIZ);
  506.       return helper.vform(fmt0, ap);
  507.   }
  508.   
  509.   #ifdef FLOATING_POINT
  510.   
  511. ! #include "floatio.h"
  512.   #define    BUF        (MAXEXP+MAXFRACT+1)    /* + decimal point */
  513.   #define    DEFPREC        6
  514.   extern "C" double modf(double, double*);
  515. --- 81,97 ----
  516.   
  517.   int help_vform(streambuf *sb, char const *fmt0, va_list ap)
  518.   {
  519. !     char buf[_G_BUFSIZ]; // WARNING: on the atari _G_BUFSIZ is a
  520. !              // variable. thats OK with GCC but other
  521. !              // compilers will barf!
  522. !     help_streambuf helper(sb, buf, _G_BUFSIZ);
  523.       return helper.vform(fmt0, ap);
  524.   }
  525.   
  526.   #ifdef FLOATING_POINT
  527.   
  528. ! #include <floatio.h>
  529.   #define    BUF        (MAXEXP+MAXFRACT+1)    /* + decimal point */
  530.   #define    DEFPREC        6
  531.   extern "C" double modf(double, double*);
  532. ***************
  533. *** 122,130 ****
  534.   #define    ZEROPAD        0x20        /* zero (as opposed to blank) pad */
  535.   #define    HEXPREFIX    0x40        /* add 0x or 0X prefix */
  536.   
  537. ! int streambuf::vform(char const *fmt0, _G_va_list args)
  538.   {
  539. -     va_list ap = (va_list)args;
  540.       register char *fmt;    /* format string */
  541.       register int ch;    /* character from fmt */
  542.       register int n;        /* handy integer (short term usage) */
  543. --- 121,128 ----
  544.   #define    ZEROPAD        0x20        /* zero (as opposed to blank) pad */
  545.   #define    HEXPREFIX    0x40        /* add 0x or 0X prefix */
  546.   
  547. ! int streambuf::vform(char const *fmt0, _G_va_list ap)
  548.   {
  549.       register char *fmt;    /* format string */
  550.       register int ch;    /* character from fmt */
  551.       register int n;        /* handy integer (short term usage) */
  552. ***************
  553. *** 190,199 ****
  554.       (flags&LONGINT ? va_arg(ap, unsigned long) : \
  555.           flags&SHORTINT ? (unsigned long)(unsigned short)va_arg(ap, int) : \
  556.           (unsigned long)va_arg(ap, unsigned int))
  557. -     /* sorry, fprintf(read_only_file, "") returns EOF, not 0 */
  558. -     if (!(_flags & _S_CAN_WRITE))
  559. -         return (EOF);
  560.   
  561.       /* optimise cerr (and other unbuffered Unix files) */
  562.       if (unbuffered())
  563. --- 188,193 ----
  564. *** 1.1    1992/03/22 07:42:32
  565. --- sbufvsca.cc    1992/06/03 14:00:06
  566. ***************
  567. *** 39,45 ****
  568.   #endif
  569.   
  570.   #ifdef FLOATING_POINT
  571. ! #include "floatio.h"
  572.   #define    BUF    (MAXEXP+MAXFRACT+3)    /* 3 = sign + decimal point + NUL */
  573.   #else
  574.   #define    BUF    40
  575. --- 39,45 ----
  576.   #endif
  577.   
  578.   #ifdef FLOATING_POINT
  579. ! #include <floatio.h>
  580.   #define    BUF    (MAXEXP+MAXFRACT+3)    /* 3 = sign + decimal point + NUL */
  581.   #else
  582.   #define    BUF    40
  583. ***************
  584. *** 84,92 ****
  585.   extern "C" u_long strtoul(const char*, char**, int);
  586.   static u_char *__sccl(register char *tab, register u_char *fmt);
  587.   
  588. ! int streambuf::vscan(char const *fmt0, _G_va_list args)
  589.   {
  590. -         va_list ap = (va_list)args;
  591.       register u_char *fmt = (u_char *)fmt0;
  592.       register int c;        /* character from format, or conversion */
  593.       register size_t width;    /* field width, or 0 */
  594. --- 84,91 ----
  595.   extern "C" u_long strtoul(const char*, char**, int);
  596.   static u_char *__sccl(register char *tab, register u_char *fmt);
  597.   
  598. ! int streambuf::vscan(char const *fmt0, _G_va_list ap)
  599.   {
  600.       register u_char *fmt = (u_char *)fmt0;
  601.       register int c;        /* character from format, or conversion */
  602.       register size_t width;    /* field width, or 0 */
  603. ***************
  604. *** 358,368 ****
  605.                   *p++ = *_gptr++;
  606.                   if (--width == 0)
  607.                       break;
  608. !                 if (sgetc() == EOF)
  609. !                     if (p == p0) {
  610.                       goto input_failure;
  611. !                     break;
  612. !                     }
  613.                   }
  614.                   n = p - p0;
  615.                   if (n == 0)
  616. --- 357,367 ----
  617.                   *p++ = *_gptr++;
  618.                   if (--width == 0)
  619.                       break;
  620. !                 if (sgetc() == EOF) {
  621. !                     if (p == p0)
  622.                       goto input_failure;
  623. !                     break;
  624. !                 }
  625.                   }
  626.                   n = p - p0;
  627.                   if (n == 0)
  628. *** 1.1    1992/03/22 07:42:32
  629. --- sgetline.cc    1992/06/03 14:00:06
  630. ***************
  631. *** 15,21 ****
  632.   //    License along with this library; if not, write to the Free
  633.   //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  634.   
  635. ! #include "ioprivat.h"
  636.   
  637.   // Algorithm based on that used by Berkeley pre-4.4 fgets implementation.
  638.   
  639. --- 15,21 ----
  640.   //    License along with this library; if not, write to the Free
  641.   //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  642.   
  643. ! #include <ioprivat.h>
  644.   
  645.   // Algorithm based on that used by Berkeley pre-4.4 fgets implementation.
  646.   
  647. *** 1.1    1992/03/22 07:42:32
  648. --- stdstrea.cc    1992/06/03 14:00:06
  649. ***************
  650. *** 15,23 ****
  651.   //    License along with this library; if not, write to the Free
  652.   //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  653.   
  654. ! #include "ioprivat.h"
  655. ! #include "ioconfig.h"
  656. ! #ifdef NAMES_HAVE_UNDERSCORE
  657.   #define UNDERSCORE "_"
  658.   #else
  659.   #define UNDERSCORE ""
  660. --- 15,24 ----
  661.   //    License along with this library; if not, write to the Free
  662.   //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  663.   
  664. ! #include <ioprivat.h>
  665. ! #include <g_config.h>
  666. ! #if _G_NAMES_HAVE_UNDERSCORE
  667.   #define UNDERSCORE "_"
  668.   #else
  669.   #define UNDERSCORE ""
  670. ***************
  671. *** 38,44 ****
  672.   #define cout COUT
  673.   #define cerr CERR
  674.   #define clog CLOG
  675. ! #include "iostream.h"
  676.   #undef cin
  677.   #undef cout
  678.   #undef cerr
  679. --- 39,45 ----
  680.   #define cout COUT
  681.   #define cerr CERR
  682.   #define clog CLOG
  683. ! #include <iostream.h>
  684.   #undef cin
  685.   #undef cout
  686.   #undef cerr
  687. *** 1.1    1992/03/22 07:42:32
  688. --- stream.cc    1992/06/03 14:00:07
  689. ***************
  690. *** 1,8 ****
  691.   #include <stdarg.h>
  692. ! #include "ioprivat.h"
  693. ! #include "stream.h"
  694. ! #include "strstrea.h"
  695.   
  696.   static char Buffer[BUFSIZ];
  697.   #define EndBuffer (Buffer+BUFSIZ)
  698.   static char* next_chunk = Buffer; // Start of available part of Buffer.
  699. --- 1,16 ----
  700.   #include <stdarg.h>
  701. ! #include <ioprivat.h>
  702. ! #include <stream.h>
  703. ! #include <strstrea.h>
  704. ! // WARNING: dont do this for the atari because _G_BUFSIZ is a variable
  705. ! // not a constant.
  706. ! #ifndef atarist
  707. ! #undef BUFSIZ
  708. ! #define BUFSIZ _G_BUFSIZ
  709. ! #endif
  710.   
  711.   static char Buffer[BUFSIZ];
  712.   #define EndBuffer (Buffer+BUFSIZ)
  713.   static char* next_chunk = Buffer; // Start of available part of Buffer.
  714. ***************
  715. *** 10,17 ****
  716.   char* form(const char* format, ...)
  717.   {
  718.       size_t space_left = EndBuffer - next_chunk;
  719. !     if (space_left < (BUFSIZ>>2)) // If less that 25% of the space is available
  720. !     next_chunk = Buffer; // start over.
  721.       char* buf = next_chunk;
  722.   
  723.       strstreambuf stream(buf, EndBuffer-buf-1, buf);
  724. --- 18,26 ----
  725.   char* form(const char* format, ...)
  726.   {
  727.       size_t space_left = EndBuffer - next_chunk;
  728. !     // If less that 25% of the space is available start over.
  729. !     if (space_left < (BUFSIZ>>2))
  730. !     next_chunk = Buffer;
  731.       char* buf = next_chunk;
  732.   
  733.       strstreambuf stream(buf, EndBuffer-buf-1, buf);
  734. ***************
  735. *** 44,51 ****
  736.       if (needed < (2+neg) || ptr > EndBuffer)
  737.       return NULL;
  738.       *--ptr = 0;
  739. -     if (neg)
  740. -     *--ptr = '-';
  741.       
  742.       if (i == 0)
  743.       *--ptr = '0';
  744. --- 53,58 ----
  745. ***************
  746. *** 58,63 ****
  747. --- 65,72 ----
  748.           ch += '0';
  749.       *--ptr = ch;
  750.       }
  751. +     if (neg)
  752. +     *--ptr = '-';
  753.       if (size == 0)
  754.       return ptr;
  755.       while (ptr > buf)
  756. *** 1.2    1992/04/19 17:18:59
  757. --- strstrea.cc    1992/06/03 14:00:07
  758. ***************
  759. *** 18,24 ****
  760.   #ifdef __GNUG__
  761.   #pragma implementation
  762.   #endif
  763. ! #include "ioprivat.h"
  764.   #include <strstrea.h>
  765.   
  766.   istrstream::istrstream(char *cp) : istream(NULL)
  767. --- 18,24 ----
  768.   #ifdef __GNUG__
  769.   #pragma implementation
  770.   #endif
  771. ! #include <ioprivat.h>
  772.   #include <strstrea.h>
  773.   
  774.   istrstream::istrstream(char *cp) : istream(NULL)
  775. ***************
  776. *** 135,141 ****
  777.       setb(_buffer, _buffer+_size);
  778.       setp(_buffer, _buffer+_size);
  779.       setg(_buffer, _buffer, _buffer);
  780. -     xsetflags(_S_CAN_READ | _S_CAN_WRITE);
  781.   }
  782.   
  783.   strstreambuf::strstreambuf(int initial)
  784. --- 135,140 ----
  785. ***************
  786. *** 150,156 ****
  787.       setb(_buffer, _buffer+_size);
  788.       setp(_buffer, _buffer+_size);
  789.       setg(_buffer, _buffer, _buffer);
  790. -     xsetflags(_S_CAN_READ | _S_CAN_WRITE);
  791.   }
  792.   
  793.   strstreambuf::strstreambuf(char *ptr, size_t size, char *pstart)
  794. --- 149,154 ----
  795. ***************
  796. *** 175,187 ****
  797.       }
  798.       else
  799.       _size = size;
  800. -     // I am not sure this change is correct... -- schenk@cpsc.ucalgary.ca
  801. -     _len = _size;
  802.       _buffer = ptr;
  803. -     int new_flags = _S_CAN_READ;
  804.       setb(_buffer, _buffer+_size);
  805.       if (pstart) {
  806. -     new_flags |= _S_CAN_WRITE;
  807.       setp(_buffer, _buffer+_size);
  808.       pbump(pstart-_buffer);
  809.       setg(_buffer, _buffer, pstart);
  810. --- 173,181 ----
  811. ***************
  812. *** 190,196 ****
  813.       setp(_buffer, _buffer); 
  814.       setg(_buffer, _buffer, _buffer+_size);
  815.       }
  816. !     xsetflags(new_flags);
  817.   }
  818.   
  819.   strstreambuf::~strstreambuf()
  820. --- 184,190 ----
  821.       setp(_buffer, _buffer); 
  822.       setg(_buffer, _buffer, _buffer+_size);
  823.       }
  824. !     _len = egptr() - _buffer;
  825.   }
  826.   
  827.   strstreambuf::~strstreambuf()
  828. ***************
  829. *** 203,210 ****
  830.                       int mode /*=ios::in|ios::out*/)
  831.   {
  832.       size_t cur_size = pcount();
  833. !     streampos new_pos = EOF; 
  834. !     if ((mode & ios::in) && (xflags() & _S_CAN_READ)) {
  835.       switch (dir) {
  836.         case ios::end:
  837.           off += cur_size;
  838. --- 197,206 ----
  839.                       int mode /*=ios::in|ios::out*/)
  840.   {
  841.       size_t cur_size = pcount();
  842. !     streampos new_pos = EOF;
  843. !     // Move the get pointer, if requested.
  844. !     if (mode & ios::in) {
  845.       switch (dir) {
  846.         case ios::end:
  847.           off += cur_size;
  848. ***************
  849. *** 216,226 ****
  850.           break;
  851.       }
  852.       if (off < 0 || (size_t)off > cur_size)
  853. !         return (streampos)(EOF);
  854.       setg(_buffer, _buffer + off, _buffer + cur_size);
  855.       new_pos = off;
  856.       }
  857. !     if ((mode & ios::out) && (xflags() & _S_CAN_WRITE)) {
  858.       switch (dir) {
  859.         case ios::end:
  860.           off += cur_size;
  861. --- 212,224 ----
  862.           break;
  863.       }
  864.       if (off < 0 || (size_t)off > cur_size)
  865. !         return EOF;
  866.       setg(_buffer, _buffer + off, _buffer + cur_size);
  867.       new_pos = off;
  868.       }
  869. !     // Move the put pointer, if requested.
  870. !     if (mode & ios::out) {
  871.       switch (dir) {
  872.         case ios::end:
  873.           off += cur_size;
  874. ***************
  875. *** 232,238 ****
  876.           break;
  877.       }
  878.       if (off < 0 || (size_t)off > cur_size)
  879. !         return (streampos)(EOF);
  880.       pbump(_buffer + off - pptr());
  881.       new_pos = off;
  882.       }
  883. --- 230,236 ----
  884.           break;
  885.       }
  886.       if (off < 0 || (size_t)off > cur_size)
  887. !         return EOF;
  888.       pbump(_buffer + off - pptr());
  889.       new_pos = off;
  890.       }
  891. *** 1.1    1992/03/22 07:42:32
  892. --- timer.cc    1992/06/03 14:00:07
  893. ***************
  894. *** 31,49 ****
  895.   #if 1
  896.   
  897.   #include <sys/types.h>
  898. ! #if defined(USG) || defined(atarist)
  899.   extern "C" {
  900.   #include <sys/param.h>
  901.   #include <sys/times.h>
  902.   }
  903. ! #else
  904. ! #include <osfcn.h>
  905.   #endif
  906. - #if defined(USG) || defined(atarist)
  907.   static struct tms Old_Time;
  908.   static struct tms New_Time;
  909.   #else
  910.   static struct rusage Old_Time;
  911.   static struct rusage New_Time;
  912.   #endif
  913. --- 31,49 ----
  914.   #if 1
  915.   
  916.   #include <sys/types.h>
  917. ! #include <g_config.h>
  918. ! #if !_G_HAVE_SYS_RESOURCE
  919.   extern "C" {
  920.   #include <sys/param.h>
  921.   #include <sys/times.h>
  922.   }
  923. ! #if !defined (HZ) && defined(CLK_TCK)
  924. ! #define HZ CLK_TCK
  925.   #endif
  926.   static struct tms Old_Time;
  927.   static struct tms New_Time;
  928.   #else
  929. + #include <osfcn.h>
  930.   static struct rusage Old_Time;
  931.   static struct rusage New_Time;
  932.   #endif
  933. ***************
  934. *** 52,58 ****
  935.   double start_timer()
  936.   {
  937.      Timer_Set = 1;
  938. ! #if defined(USG) || defined(atarist)
  939.      times(&Old_Time);
  940.      return((double) Old_Time.tms_utime / HZ);
  941.   #else
  942. --- 52,58 ----
  943.   double start_timer()
  944.   {
  945.      Timer_Set = 1;
  946. ! #if !_G_HAVE_SYS_RESOURCE
  947.      times(&Old_Time);
  948.      return((double) Old_Time.tms_utime / HZ);
  949.   #else
  950. ***************
  951. *** 72,84 ****
  952.      }   
  953.      else {
  954.       /* get process time */
  955. ! #if defined(USG) || defined(atarist)
  956.         times(&New_Time);
  957.   #else
  958.         getrusage(RUSAGE_SELF,&New_Time);
  959.   #endif
  960.         if (Last_Time == 0.0) {
  961. ! #if defined(USG) || defined(atarist)
  962.        return((double) (New_Time.tms_utime - Old_Time.tms_utime) / HZ);
  963.   #else
  964.            return((New_Time.ru_utime.tv_sec - Old_Time.ru_utime.tv_sec) + 
  965. --- 72,84 ----
  966.      }   
  967.      else {
  968.       /* get process time */
  969. ! #if !_G_HAVE_SYS_RESOURCE
  970.         times(&New_Time);
  971.   #else
  972.         getrusage(RUSAGE_SELF,&New_Time);
  973.   #endif
  974.         if (Last_Time == 0.0) {
  975. ! #if !_G_HAVE_SYS_RESOURCE
  976.        return((double) (New_Time.tms_utime - Old_Time.tms_utime) / HZ);
  977.   #else
  978.            return((New_Time.ru_utime.tv_sec - Old_Time.ru_utime.tv_sec) + 
  979. ***************
  980. *** 87,93 ****
  981.   #endif
  982.         }
  983.         else {
  984. ! #if defined(USG) || defined(atarist)
  985.        return((double) New_Time.tms_utime / HZ - Last_Time);
  986.   #else
  987.            return((New_Time.ru_utime.tv_sec + 
  988. --- 87,93 ----
  989.   #endif
  990.         }
  991.         else {
  992. ! #if !_G_HAVE_SYS_RESOURCE
  993.        return((double) New_Time.tms_utime / HZ - Last_Time);
  994.   #else
  995.            return((New_Time.ru_utime.tv_sec + 
  996. *** 1.2    1992/03/22 21:19:02
  997. --- xbitset.cc    1992/06/03 14:00:08
  998. ***************
  999. *** 30,35 ****
  1000. --- 30,36 ----
  1001.   #include <new.h>
  1002.   #include <builtin.h>
  1003.   #include <string.h>
  1004. + #include <strstrea.h>
  1005.   
  1006.   void BitSet::error(const char* msg) const
  1007.   {
  1008. ***************
  1009. *** 752,807 ****
  1010.   const char* BitSettoa(const BitSet& x, char f, char t, char star)
  1011.   {
  1012.     trim(x.rep);
  1013.     size_t wrksiz = (x.rep->len + 1) * BITSETBITS + 2;
  1014.     char* fmtbase = (char *) _libgxx_fmtq.alloc(wrksiz);
  1015. !   char* fmt = fmtbase;
  1016. !   const unsigned short* s = x.rep->s;
  1017. !   const unsigned short* top = &(s[x.rep->len - 1]);
  1018. !   while (s < top)
  1019. !   {
  1020. !     unsigned short a = *s++;
  1021. !     for (int j = 0; j < BITSETBITS; ++j)
  1022. !     {
  1023. !       *fmt++ = (a & 1)? t : f;
  1024. !       a >>= 1;
  1025. !     }
  1026. !   }
  1027. !   if (!x.rep->virt)
  1028. !   {
  1029. !     unsigned short a = *s;
  1030. !     if (x.rep->len != 0)
  1031. !     {
  1032. !       for (int j = 0; j < BITSETBITS && a != 0; ++j)
  1033. !       {
  1034. !         *fmt++ = (a & 1)? t : f;
  1035. !         a >>= 1;
  1036. !       }
  1037. !     }
  1038. !     *fmt++ = f;
  1039. !   }
  1040. !   else
  1041. !   {
  1042. !     unsigned short a = *s;
  1043. !     unsigned short mask = ONES;
  1044. !     unsigned short himask = (1 << (BITSETBITS - 1)) - 1;
  1045. !     if (x.rep->len != 0)
  1046. !     {
  1047. !       for (int j = 0; j < BITSETBITS && a != mask; ++j)
  1048. !       {
  1049. !         *fmt++ = (a & 1)? t : f;
  1050. !         a = (a >> 1) & himask;
  1051. !         mask = (mask >> 1) & himask;
  1052. !       }
  1053. !     }
  1054. !     *fmt++ = t;
  1055. !   }
  1056. !   *fmt++ = star;
  1057. !   *fmt++ = 0;
  1058.     return fmtbase;
  1059.   }
  1060.   
  1061. --- 753,764 ----
  1062.   const char* BitSettoa(const BitSet& x, char f, char t, char star)
  1063.   {
  1064.     trim(x.rep);
  1065.     size_t wrksiz = (x.rep->len + 1) * BITSETBITS + 2;
  1066.     char* fmtbase = (char *) _libgxx_fmtq.alloc(wrksiz);
  1067. !   ostrstream stream(fmtbase, wrksiz);
  1068. !   
  1069. !   x.printon(stream, f, t, star);
  1070. !   stream << ends;
  1071.     return fmtbase;
  1072.   }
  1073.   
  1074. ***************
  1075. *** 950,956 ****
  1076.   
  1077.   ostream& operator << (ostream& s, const BitSet& x)
  1078.   {
  1079. !   return s << BitSettoa(x);
  1080.   }
  1081.   
  1082.   int BitSet::OK() const
  1083. --- 907,966 ----
  1084.   
  1085.   ostream& operator << (ostream& s, const BitSet& x)
  1086.   {
  1087. !   if (s.opfx())
  1088. !     x.printon(s);
  1089. !   return s;
  1090. ! }
  1091. ! void BitSet::printon(ostream& s, char f, char t, char star) const
  1092. ! // FIXME:  Does not respect s.width()!
  1093. ! {
  1094. !   trim(rep);
  1095. !   register streambuf* sb = s.rdbuf();
  1096. !   const unsigned short* s = rep->s;
  1097. !   const unsigned short* top = &(s[rep->len - 1]);
  1098. !   while (s < top)
  1099. !   {
  1100. !     unsigned short a = *s++;
  1101. !     for (int j = 0; j < BITSETBITS; ++j)
  1102. !     {
  1103. !       sb->sputc((a & 1)? t : f);
  1104. !       a >>= 1;
  1105. !     }
  1106. !   }
  1107. !   if (!rep->virt)
  1108. !   {
  1109. !     unsigned short a = *s;
  1110. !     if (rep->len != 0)
  1111. !     {
  1112. !       for (int j = 0; j < BITSETBITS && a != 0; ++j)
  1113. !       {
  1114. !         sb->sputc((a & 1)? t : f);
  1115. !         a >>= 1;
  1116. !       }
  1117. !     }
  1118. !     sb->sputc(f);
  1119. !   }
  1120. !   else
  1121. !   {
  1122. !     unsigned short a = *s;
  1123. !     unsigned short mask = ONES;
  1124. !     unsigned short himask = (1 << (BITSETBITS - 1)) - 1;
  1125. !     if (rep->len != 0)
  1126. !     {
  1127. !       for (int j = 0; j < BITSETBITS && a != mask; ++j)
  1128. !       {
  1129. !         sb->sputc((a & 1)? t : f);
  1130. !         a = (a >> 1) & himask;
  1131. !         mask = (mask >> 1) & himask;
  1132. !       }
  1133. !     }
  1134. !     sb->sputc(t);
  1135. !   }
  1136. !   sb->sputc(star);
  1137.   }
  1138.   
  1139.   int BitSet::OK() const
  1140. *** 1.1    1992/03/22 07:42:32
  1141. --- xbitstri.cc    1992/06/03 14:00:09
  1142. ***************
  1143. *** 29,34 ****
  1144. --- 29,35 ----
  1145.   #include <xallocri.h>
  1146.   #include <new.h>
  1147.   #include <builtin.h>
  1148. + #include <strstrea.h>
  1149.   
  1150.   void BitString::error(const char* msg) const
  1151.   {
  1152. ***************
  1153. *** 1970,2001 ****
  1154.   
  1155.   extern AllocRing _libgxx_fmtq;
  1156.   
  1157. ! const char* BitStringtoa(const BitString& x, char f, char t)
  1158.   {
  1159. !   int wrksiz = x.length() + 2;
  1160. !   char* fmtbase = (char *) _libgxx_fmtq.alloc(wrksiz);
  1161. !   char* fmt = fmtbase;
  1162. !   size_t  xl = x.rep->len;
  1163. !   const unsigned short* s = x.rep->s;
  1164.     unsigned short a = 0;
  1165.   
  1166. !   for (size_t  i = 0; i < xl; ++i)
  1167.     {
  1168.       if (i % BITSTRBITS == 0)
  1169. !       a = *s++;
  1170. !     *fmt++ = (a & 1)? t : f;
  1171.       a >>= 1;
  1172.     }
  1173. !   *fmt = 0;
  1174.   
  1175.     return fmtbase;
  1176.   }
  1177.   
  1178.   ostream& operator << (ostream& s, const BitString& x)
  1179.   {
  1180. !   return s << BitStringtoa(x);
  1181.   }
  1182.   
  1183.   const char* BitPatterntoa(const BitPattern& p, char f,char t,char x)
  1184. --- 1971,2010 ----
  1185.   
  1186.   extern AllocRing _libgxx_fmtq;
  1187.   
  1188. ! void BitString::printon(ostream& os, char f, char t) const
  1189.   {
  1190. !   size_t wrksiz = length() + 2;
  1191. !   size_t  xl = rep->len;
  1192. !   const unsigned short* ptr = rep->s;
  1193. !   register streambuf *sb = os.rdbuf();
  1194.     unsigned short a = 0;
  1195.   
  1196. !   for (size_t i = 0; i < xl; ++i)
  1197.     {
  1198.       if (i % BITSTRBITS == 0)
  1199. !       a = *ptr++;
  1200. !     sb->sputc((a & 1)? t : f);
  1201.       a >>= 1;
  1202.     }
  1203. ! }
  1204.   
  1205. + const char* BitStringtoa(const BitString& x, char f, char t)
  1206. + {
  1207. +   size_t wrksiz = x.length() + 2;
  1208. +   char* fmtbase = (char *) _libgxx_fmtq.alloc(wrksiz);
  1209. +   char* fmt = fmtbase;
  1210. +   ostrstream stream(fmtbase, wrksiz);
  1211. +   
  1212. +   x.printon(stream, f, t);
  1213. +   stream << ends;
  1214.     return fmtbase;
  1215.   }
  1216.   
  1217.   ostream& operator << (ostream& s, const BitString& x)
  1218.   {
  1219. !   if (s.opfx())
  1220. !     x.printon(s);
  1221. !   return s;
  1222.   }
  1223.   
  1224.   const char* BitPatterntoa(const BitPattern& p, char f,char t,char x)
  1225. ***************
  1226. *** 2006,2015 ****
  1227.   
  1228.     size_t wrksiz = l + 2;
  1229.     char* fmtbase = (char *) _libgxx_fmtq.alloc(wrksiz);
  1230. !   char* fmt = fmtbase;
  1231.   
  1232. !   const unsigned short* ps = p.pattern.rep->s;
  1233. !   const unsigned short* ms = p.mask.rep->s;
  1234.     unsigned short a = 0;
  1235.     unsigned short m = 0;
  1236.   
  1237. --- 2015,2036 ----
  1238.   
  1239.     size_t wrksiz = l + 2;
  1240.     char* fmtbase = (char *) _libgxx_fmtq.alloc(wrksiz);
  1241. !   ostrstream stream(fmtbase, wrksiz);
  1242. !   
  1243. !   p.printon(stream, f, t, x);
  1244. !   stream << ends;
  1245. !   return fmtbase;
  1246. ! }
  1247. ! void BitPattern::printon(ostream& s, char f,char t,char x) const
  1248. ! {
  1249. !   unsigned int  pl = pattern.rep->len;
  1250. !   unsigned int  ml = mask.rep->len;
  1251. !   unsigned int  l = (pl <= ml)? pl : ml;
  1252. !   register streambuf *sb = s.rdbuf();
  1253.   
  1254. !   const unsigned short* ps = pattern.rep->s;
  1255. !   const unsigned short* ms = mask.rep->s;
  1256.     unsigned short a = 0;
  1257.     unsigned short m = 0;
  1258.   
  1259. ***************
  1260. *** 2021,2041 ****
  1261.         m = *ms++;
  1262.       }
  1263.       if (m & 1)
  1264. !       *fmt++ =(a & 1)? t : f;
  1265.       else
  1266. !       *fmt++ = x;
  1267.       a >>= 1;
  1268.       m >>= 1;
  1269.     }
  1270. -   *fmt = 0;
  1271. -   return fmtbase;
  1272.   }
  1273.   
  1274.   ostream& operator << (ostream& s, const BitPattern& x)
  1275.   {
  1276. !   return s << BitPatterntoa(x);
  1277.   }
  1278.   
  1279.   
  1280. --- 2042,2060 ----
  1281.         m = *ms++;
  1282.       }
  1283.       if (m & 1)
  1284. !       sb->sputc((a & 1)? t : f);
  1285.       else
  1286. !       sb->sputc(x);
  1287.       a >>= 1;
  1288.       m >>= 1;
  1289.     }
  1290.   }
  1291.   
  1292.   ostream& operator << (ostream& s, const BitPattern& x)
  1293.   {
  1294. !   if (s.opfx())
  1295. !     x.printon(s);
  1296. !   return s;
  1297.   }
  1298.   
  1299.   
  1300. *** 1.1    1992/03/22 07:42:32
  1301. --- xcursesw.cc    1992/06/03 14:00:09
  1302. ***************
  1303. *** 21,31 ****
  1304.   #include <stdarg.h>
  1305.   #include <builtin.h>
  1306.   #include <values.h>
  1307. - #include <xcursesw.h>
  1308.   #ifndef _OLD_STREAMS
  1309.   #include <strstream.h>
  1310.   #include <ioprivate.h>
  1311.   #endif
  1312.   
  1313.   int CursesWindow::count = 0;
  1314.   
  1315. --- 21,33 ----
  1316.   #include <stdarg.h>
  1317.   #include <builtin.h>
  1318.   #include <values.h>
  1319.   #ifndef _OLD_STREAMS
  1320.   #include <strstream.h>
  1321.   #include <ioprivate.h>
  1322.   #endif
  1323. + // Include CurseW.h and/or curses.h *after* iostream includes,
  1324. + // because curses.h defines a clear macro that conflicts with iostream. Sigh.
  1325. + #include <xcursesw.h>
  1326.   
  1327.   int CursesWindow::count = 0;
  1328.   
  1329. ***************
  1330. *** 47,53 ****
  1331.     va_start(args, fmt);
  1332.   #ifdef VMS
  1333.     int result = wscanw(w , fmt , args);
  1334. ! #else
  1335.     char buf[BUFSIZ];
  1336.     int result = wgetstr(w, buf);
  1337.     if (result == OK) {
  1338. --- 49,55 ----
  1339.     va_start(args, fmt);
  1340.   #ifdef VMS
  1341.     int result = wscanw(w , fmt , args);
  1342. ! #else /* NOT VMS */
  1343.     char buf[BUFSIZ];
  1344.     int result = wgetstr(w, buf);
  1345.     if (result == OK) {
  1346. ***************
  1347. *** 62,73 ****
  1348.         b._ptr = buf;
  1349.         b._cnt = BUFSIZ;
  1350.         result = _doscan(&b, fmt, args);
  1351. ! #else
  1352.         result = vsscanf(buf, fmt, args);
  1353. ! #endif
  1354.   #endif /* _OLD_STREAMS */
  1355. - #endif
  1356.     }
  1357.     va_end(args);
  1358.     return result;
  1359.   }
  1360. --- 64,75 ----
  1361.         b._ptr = buf;
  1362.         b._cnt = BUFSIZ;
  1363.         result = _doscan(&b, fmt, args);
  1364. ! #else /* HAVE_VSCANF */
  1365.         result = vsscanf(buf, fmt, args);
  1366. ! #endif /* HAVE_VSCANF */
  1367.   #endif /* _OLD_STREAMS */
  1368.     }
  1369. + #endif /* !VMS */
  1370.     va_end(args);
  1371.     return result;
  1372.   }
  1373. ***************
  1374. *** 76,82 ****
  1375.   {
  1376.     va_list args;
  1377.     va_start(args, fmt);
  1378. - #ifndef VMS
  1379.     char buf[BUFSIZ];
  1380.     int result = wmove(w, y, x);
  1381.     if (result == OK)
  1382. --- 78,83 ----
  1383. ***************
  1384. *** 83,89 ****
  1385.   #ifdef VMS
  1386.     result=wscanw(w , fmt , args);
  1387.   #else /* !VMS */
  1388. !   {
  1389.       result = wgetstr(w, buf);
  1390.       if (result == OK) {
  1391.   #ifndef _OLD_STREAMS
  1392. --- 84,90 ----
  1393.   #ifdef VMS
  1394.     result=wscanw(w , fmt , args);
  1395.   #else /* !VMS */
  1396. !  {
  1397.       result = wgetstr(w, buf);
  1398.       if (result == OK) {
  1399.   #ifndef _OLD_STREAMS
  1400. ***************
  1401. *** 101,110 ****
  1402.       result = vsscanf(buf, fmt, args);
  1403.   #endif
  1404.   #endif /* OLD_STREAMS */
  1405. - #endif /* !VMS */
  1406. -     }
  1407.     }
  1408. ! #endif
  1409.     va_end(args);
  1410.     return result;
  1411.   }
  1412. --- 102,110 ----
  1413.       result = vsscanf(buf, fmt, args);
  1414.   #endif
  1415.   #endif /* OLD_STREAMS */
  1416.     }
  1417. !   }
  1418. ! #endif /* !VMS */
  1419.     va_end(args);
  1420.     return result;
  1421.   }
  1422. *** 1.1    1992/03/22 07:42:32
  1423. --- xeh.cc    1992/06/03 14:00:10
  1424. ***************
  1425. *** 7,12 ****
  1426. --- 7,13 ----
  1427.   #endif
  1428.   #include <setjmp.h>
  1429.   #include <stream.h>
  1430. + #include <osfcn.h>
  1431.   
  1432.   struct
  1433.   ExceptionHandler
  1434. *** 1.1    1992/03/22 07:42:32
  1435. --- xfix.cc    1992/06/03 14:00:10
  1436. ***************
  1437. *** 26,31 ****
  1438. --- 26,32 ----
  1439.   #include <std.h>
  1440.   #include <xobstack.h>
  1441.   #include <xallocri.h>
  1442. + #include <strstrea.h>
  1443.   
  1444.   // default parameters
  1445.   
  1446. ***************
  1447. *** 451,468 ****
  1448.   
  1449.   extern AllocRing _libgxx_fmtq;
  1450.   
  1451.   char* Ftoa(Fix& x, int width)
  1452.   {
  1453.     int wrksiz = width + 2;
  1454. !   char *s = (char *) _libgxx_fmtq.alloc(wrksiz);
  1455. !   char format[100];
  1456. !   double val = value(x);
  1457. !   if (val < 0)
  1458. !     sprintf(format,"%%%d.%dlf",width-2,width-3);
  1459. !   else
  1460. !     sprintf(format," %%%d.%dlf",width-2,width-3);
  1461. !   sprintf(s,format,val);
  1462. !   return s;
  1463.   }
  1464.   
  1465.   extern Obstack _libgxx_io_ob;
  1466. --- 452,480 ----
  1467.   
  1468.   extern AllocRing _libgxx_fmtq;
  1469.   
  1470. + void Fix::printon(ostream& s, int width)
  1471. + {
  1472. +   char format[20];
  1473. +   double val = value(*this);
  1474. +   int old_precision = s.precision(width-3);
  1475. +   fmtflags old_flags = s.setf(ios::fixed, ios::fixed|ios::scientific);
  1476. +   if (val >= 0)
  1477. +       s << ' ';
  1478. +   s.width(width-2);
  1479. +   s << val;
  1480. +   s.precision(old_precision);
  1481. +   s.flags(old_flags);
  1482. + }
  1483.   char* Ftoa(Fix& x, int width)
  1484.   {
  1485.     int wrksiz = width + 2;
  1486. !   char *fmtbase = (char *) _libgxx_fmtq.alloc(wrksiz);
  1487. !   ostrstream stream(fmtbase, wrksiz);
  1488. !   
  1489. !   x.printon(stream, width);
  1490. !   stream << ends;
  1491. !   return fmtbase;
  1492.   }
  1493.   
  1494.   extern Obstack _libgxx_io_ob;
  1495. ***************
  1496. *** 542,548 ****
  1497.     cout << "len = " << x.rep->len << "\n";
  1498.     cout << "siz = " << x.rep->siz << "\n";
  1499.     cout << "ref = " << x.rep->ref << "\n";
  1500. !   cout << "man = " << Itoa(mantissa(x),16,4*x.rep->siz) << "\n";
  1501.     cout << "val = " << value(x) << "\n";
  1502.   }
  1503.   
  1504. --- 554,569 ----
  1505.     cout << "len = " << x.rep->len << "\n";
  1506.     cout << "siz = " << x.rep->siz << "\n";
  1507.     cout << "ref = " << x.rep->ref << "\n";
  1508. !   cout << "man = ";
  1509. ! #ifdef _OLD_STREAMS
  1510. !   cout << Itoa(mantissa(x),16,4*x.rep->siz);
  1511. ! #else
  1512. !   int old_flags = cout.setf(ios::hex, ios::hex|ios::dec|ios::oct);
  1513. !   cout.width(4*x.rep->siz);
  1514. !   cout << mantissa(x);
  1515. !   cout.setf(old_flags, ios::hex|ios::dec|ios::oct);
  1516. ! #endif
  1517. !   cout << "\n";
  1518.     cout << "val = " << value(x) << "\n";
  1519.   }
  1520.   
  1521. *** 1.2    1992/03/22 21:19:02
  1522. --- xfix24.cc    1992/06/03 14:00:11
  1523. ***************
  1524. *** 204,234 ****
  1525.     return r;
  1526.   }
  1527.   
  1528. - Fix48 operator * (Fix48& a, int b)
  1529. - {
  1530. -   twolongs r;
  1531. -   int bpos = (b >= 0);
  1532. -   unsigned ub = (bpos)? b : -b;
  1533. -   if ( ub >= 65536L ) {
  1534. -     r = (bpos)? Fix48_m_max : Fix48_m_min;
  1535. -     a.range_error(r);
  1536. -   }
  1537. -   else {
  1538. -     unsigned long 
  1539. -       lo_r = (a.m.l & 0xffff) * ub,
  1540. -       mi_r = ((a.m.l >> 16) & 0xffff) * ub,
  1541. -       hi_r = a.m.u * ub;
  1542. -     r.l = lo_r + (mi_r << 16);
  1543. -     r.u = hi_r + ((mi_r >> 8) & 0x00ffff00L);
  1544. -     if ( !bpos ) {
  1545. -       unsigned long l = r.l;
  1546. -       r.l = -r.l;
  1547. -       r.u = ~r.u + ((l ^ r.l) & Fix24_msb ? 0 : Fix24_lsb);
  1548. -     }
  1549. -   }
  1550. -   return r;
  1551. - }
  1552.   Fix48 operator << (Fix48& a, int b)
  1553.   {
  1554.     twolongs r; r.u = r.l = 0;
  1555. --- 204,209 ----
  1556. *** 1.1    1992/03/22 07:42:32
  1557. --- xinteger.cc    1992/06/03 14:00:12
  1558. ***************
  1559. *** 66,72 ****
  1560. --- 66,76 ----
  1561.   #define MALLOC_MIN_OVERHEAD 4
  1562.   #endif
  1563.   
  1564. + IntRep _ZeroRep = {1, 0, 1, {0}};
  1565. + IntRep _OneRep = {1, 0, 1, {1}};
  1566. + IntRep _MinusOneRep = {1, 0, 0, {1}};
  1567.   
  1568.   // utilities to extract and transfer bits 
  1569.   
  1570.   // get low bits
  1571. ***************
  1572. *** 177,183 ****
  1573.     scpy(src, rep->s, srclen);
  1574.     Iclear_from(rep, srclen);
  1575.   
  1576. !   if (old != rep && old != 0) delete old;
  1577.     return rep;
  1578.   }
  1579.   
  1580. --- 181,187 ----
  1581.     scpy(src, rep->s, srclen);
  1582.     Iclear_from(rep, srclen);
  1583.   
  1584. !   if (old != rep && old != 0 && !STATIC_IntRep(old)) delete old;
  1585.     return rep;
  1586.   }
  1587.   
  1588. ***************
  1589. *** 188,194 ****
  1590.     IntRep* rep;
  1591.     if (old == 0 || newlen > old->sz)
  1592.     {
  1593. !     if (old != 0) delete old;
  1594.       rep = Inew(newlen);
  1595.     }
  1596.     else
  1597. --- 192,198 ----
  1598.     IntRep* rep;
  1599.     if (old == 0 || newlen > old->sz)
  1600.     {
  1601. !     if (old != 0 && !STATIC_IntRep(old)) delete old;
  1602.       rep = Inew(newlen);
  1603.     }
  1604.     else
  1605. ***************
  1606. *** 221,227 ****
  1607.         rep = Inew(newlen);
  1608.         scpy(old->s, rep->s, oldlen);
  1609.         rep->sgn = old->sgn;
  1610. !       delete old;
  1611.       }
  1612.       else
  1613.         rep = old;
  1614. --- 225,231 ----
  1615.         rep = Inew(newlen);
  1616.         scpy(old->s, rep->s, oldlen);
  1617.         rep->sgn = old->sgn;
  1618. !       if (!STATIC_IntRep(old)) delete old;
  1619.       }
  1620.       else
  1621.         rep = old;
  1622. ***************
  1623. *** 257,263 ****
  1624.       int newlen = src->len;
  1625.       if (old == 0 || newlen > old->sz)
  1626.       {
  1627. !       if (old != 0) delete old;
  1628.         rep = Inew(newlen);
  1629.       }
  1630.       else
  1631. --- 261,267 ----
  1632.       int newlen = src->len;
  1633.       if (old == 0 || newlen > old->sz)
  1634.       {
  1635. !       if (old != 0 && !STATIC_IntRep(old)) delete old;
  1636.         rep = Inew(newlen);
  1637.       }
  1638.       else
  1639. ***************
  1640. *** 294,300 ****
  1641.     IntRep* rep;
  1642.     if (old == 0 || srclen > old->sz)
  1643.     {
  1644. !     if (old != 0) delete old;
  1645.       rep = Inew(srclen);
  1646.     }
  1647.     else
  1648. --- 298,304 ----
  1649.     IntRep* rep;
  1650.     if (old == 0 || srclen > old->sz)
  1651.     {
  1652. !     if (old != 0 && !STATIC_IntRep(old)) delete old;
  1653.       rep = Inew(srclen);
  1654.     }
  1655.     else
  1656. ***************
  1657. *** 313,328 ****
  1658.   
  1659.   IntRep* Icopy_zero(IntRep* old)
  1660.   {
  1661. -   IntRep* rep;
  1662.     if (old == 0)
  1663. !     rep = Inew(0);
  1664. !   else
  1665. !     rep = old;
  1666.   
  1667. !   rep->len = 0;
  1668. !   rep->sgn = I_POSITIVE;
  1669.   
  1670. !   return rep;
  1671.   }
  1672.   
  1673.   // special case for 1 or -1
  1674. --- 317,329 ----
  1675.   
  1676.   IntRep* Icopy_zero(IntRep* old)
  1677.   {
  1678.     if (old == 0)
  1679. !     return &_ZeroRep;
  1680.   
  1681. !   old->len = 0;
  1682. !   old->sgn = I_POSITIVE;
  1683.   
  1684. !   return old;
  1685.   }
  1686.   
  1687.   // special case for 1 or -1
  1688. ***************
  1689. *** 329,348 ****
  1690.   
  1691.   IntRep* Icopy_one(IntRep* old, int newsgn)
  1692.   {
  1693. -   IntRep* rep;
  1694.     if (old == 0 || 1 > old->sz)
  1695.     {
  1696. !     if (old != 0) delete old;
  1697. !     rep = Inew(1);
  1698.     }
  1699. -   else
  1700. -     rep = old;
  1701.   
  1702. !   rep->sgn = newsgn;
  1703. !   rep->len = 1;
  1704. !   rep->s[0] = 1;
  1705.   
  1706. !   return rep;
  1707.   }
  1708.   
  1709.   // convert to a legal two's complement long if possible
  1710. --- 330,346 ----
  1711.   
  1712.   IntRep* Icopy_one(IntRep* old, int newsgn)
  1713.   {
  1714.     if (old == 0 || 1 > old->sz)
  1715.     {
  1716. !     if (old != 0 && !STATIC_IntRep(old)) delete old;
  1717. !     return newsgn==I_NEGATIVE ? &_MinusOneRep : &_OneRep;
  1718.     }
  1719.   
  1720. !   old->sgn = newsgn;
  1721. !   old->len = 1;
  1722. !   old->s[0] = 1;
  1723.   
  1724. !   return old;
  1725.   }
  1726.   
  1727.   // convert to a legal two's complement long if possible
  1728. ***************
  1729. *** 1234,1241 ****
  1730.       q = Icalloc(q, ql);
  1731.       do_divide(r->s, yy->s, yl, q->s, ql);
  1732.   
  1733. !     if (yy != y) delete yy;
  1734. !     delete r;
  1735.     }
  1736.     q->sgn = samesign;
  1737.     Icheck(q);
  1738. --- 1232,1239 ----
  1739.       q = Icalloc(q, ql);
  1740.       do_divide(r->s, yy->s, yl, q->s, ql);
  1741.   
  1742. !     if (yy != y && !STATIC_IntRep(yy)) delete yy;
  1743. !     if (!STATIC_IntRep(r)) delete r;
  1744.     }
  1745.     q->sgn = samesign;
  1746.     Icheck(q);
  1747. ***************
  1748. *** 1302,1308 ****
  1749.       q = Icalloc(q, ql);
  1750.       do_divide(r->s, ys, yl, q->s, ql);
  1751.   
  1752. !     delete r;
  1753.     }
  1754.     q->sgn = samesign;
  1755.     Icheck(q);
  1756. --- 1300,1306 ----
  1757.       q = Icalloc(q, ql);
  1758.       do_divide(r->s, ys, yl, q->s, ql);
  1759.   
  1760. !     if (!STATIC_IntRep(r)) delete r;
  1761.     }
  1762.     q->sgn = samesign;
  1763.     Icheck(q);
  1764. ***************
  1765. *** 1384,1390 ****
  1766.       }
  1767.       Icheck(r);
  1768.       rem = Itolong(r);
  1769. !     delete r;
  1770.     }
  1771.     rem = abs(rem);
  1772.     if (xsgn == I_NEGATIVE) rem = -rem;
  1773. --- 1382,1388 ----
  1774.       }
  1775.       Icheck(r);
  1776.       rem = Itolong(r);
  1777. !     if (!STATIC_IntRep(r)) delete r;
  1778.     }
  1779.     rem = abs(rem);
  1780.     if (xsgn == I_NEGATIVE) rem = -rem;
  1781. ***************
  1782. *** 1453,1459 ****
  1783.       q = Icalloc(q, ql);
  1784.       do_divide(r->s, yy->s, yl, q->s, ql);
  1785.   
  1786. !     if (yy != y) delete yy;
  1787.       if (prescale != 1)
  1788.       {
  1789.         Icheck(r);
  1790. --- 1451,1457 ----
  1791.       q = Icalloc(q, ql);
  1792.       do_divide(r->s, yy->s, yl, q->s, ql);
  1793.   
  1794. !     if (yy != y && !STATIC_IntRep(yy)) delete yy;
  1795.       if (prescale != 1)
  1796.       {
  1797.         Icheck(r);
  1798. ***************
  1799. *** 1507,1513 ****
  1800.         
  1801.       do_divide(r->s, yy->s, yl, 0, xl - yl + 1);
  1802.   
  1803. !     if (yy != y) delete yy;
  1804.   
  1805.       if (prescale != 1)
  1806.       {
  1807. --- 1505,1511 ----
  1808.         
  1809.       do_divide(r->s, yy->s, yl, 0, xl - yl + 1);
  1810.   
  1811. !     if (yy != y && !STATIC_IntRep(yy)) delete yy;
  1812.   
  1813.       if (prescale != 1)
  1814.       {
  1815. ***************
  1816. *** 1947,1954 ****
  1817.         t = add(t, 0, u, 0, t);
  1818.       }
  1819.     }
  1820. !   delete t;
  1821. !   delete v;
  1822.     if (k != 0) u = lshift(u, k, u);
  1823.     return u;
  1824.   }
  1825. --- 1945,1952 ----
  1826.         t = add(t, 0, u, 0, t);
  1827.       }
  1828.     }
  1829. !   if (!STATIC_IntRep(t)) delete t;
  1830. !   if (!STATIC_IntRep(v)) delete v;
  1831.     if (k != 0) u = lshift(u, k, u);
  1832.     return u;
  1833.   }
  1834. ***************
  1835. *** 2006,2012 ****
  1836.         else
  1837.           b = multiply(b, b, b);
  1838.       }
  1839. !     delete b;
  1840.     }
  1841.     r->sgn = sgn;
  1842.     Icheck(r);
  1843. --- 2004,2010 ----
  1844.         else
  1845.           b = multiply(b, b, b);
  1846.       }
  1847. !     if (!STATIC_IntRep(b)) delete b;
  1848.     }
  1849.     r->sgn = sgn;
  1850.     Icheck(r);
  1851. ***************
  1852. *** 2160,2183 ****
  1853.   #ifdef _OLD_STREAMS
  1854.     return s << Itoa(y.rep);
  1855.   #else
  1856. !   int base = (s.flags() & ios::oct) ? 8 : (s.flags() & ios::hex) ? 16 : 10;
  1857.     int align_right = !(s.flags() & ios::left);
  1858.     int showpos = s.flags() & ios::showpos;
  1859.     int showbase = s.flags() & ios::showbase;
  1860.     char fillchar = s.fill();
  1861.     char Xcase = (s.flags() & ios::uppercase)? 'X' : 'x';
  1862. !   int width = s.width();
  1863. !   const IntRep* x = y.rep;
  1864.     int fmtlen = (x->len + 1) * I_SHIFT / lg(base) + 4 + width;
  1865.     char* fmtbase = new char[fmtlen];
  1866.     char* f = cvtItoa(x, fmtbase, fmtlen, base, showbase, width, align_right,
  1867. !                     fillchar, Xcase, showpos);
  1868.     s.write(f, fmtlen);
  1869.     delete fmtbase;
  1870. -   return s;
  1871. - #endif
  1872.   }
  1873. -   
  1874.   
  1875.   char*  cvtItoa(const IntRep* x, char* fmt, int& fmtlen, int base, int showbase,
  1876.                 int width, int align_right, char fillchar, char Xcase, 
  1877. --- 2158,2188 ----
  1878.   #ifdef _OLD_STREAMS
  1879.     return s << Itoa(y.rep);
  1880.   #else
  1881. !   if (s.opfx())
  1882. !     {
  1883. !       int base = (s.flags() & ios::oct) ? 8 : (s.flags() & ios::hex) ? 16 : 10;
  1884. !       int width = s.width();
  1885. !       y.printon(s, base, width);
  1886. !     }
  1887. !   return s;
  1888. ! #endif
  1889. ! }
  1890. ! void Integer::printon(ostream& s, int base /* =10 */, int width /* =0 */) const
  1891. ! {
  1892.     int align_right = !(s.flags() & ios::left);
  1893.     int showpos = s.flags() & ios::showpos;
  1894.     int showbase = s.flags() & ios::showbase;
  1895.     char fillchar = s.fill();
  1896.     char Xcase = (s.flags() & ios::uppercase)? 'X' : 'x';
  1897. !   const IntRep* x = rep;
  1898.     int fmtlen = (x->len + 1) * I_SHIFT / lg(base) + 4 + width;
  1899.     char* fmtbase = new char[fmtlen];
  1900.     char* f = cvtItoa(x, fmtbase, fmtlen, base, showbase, width, align_right,
  1901. !             fillchar, Xcase, showpos);
  1902.     s.write(f, fmtlen);
  1903.     delete fmtbase;
  1904.   }
  1905.   
  1906.   char*  cvtItoa(const IntRep* x, char* fmt, int& fmtlen, int base, int showbase,
  1907.                 int width, int align_right, char fillchar, char Xcase, 
  1908. ***************
  1909. *** 2222,2228 ****
  1910.               ch += '0';
  1911.             *--s = ch;
  1912.           }
  1913. !         delete z;
  1914.           break;
  1915.         }
  1916.         else
  1917. --- 2227,2233 ----
  1918.               ch += '0';
  1919.             *--s = ch;
  1920.           }
  1921. !     if (!STATIC_IntRep(z)) delete z;
  1922.           break;
  1923.         }
  1924.         else
  1925. ***************
  1926. *** 2390,2405 ****
  1927.   
  1928.   int Integer::OK() const
  1929.   {
  1930. !   int v = rep != 0;             // have a rep
  1931. !   int l = rep->len;
  1932. !   int s = rep->sgn;
  1933. !   v &= l <= rep->sz;            // length with bounds
  1934. !   v &= s == 0 || s == 1;        // legal sign
  1935. !   Icheck(rep);                  // and correctly adjusted
  1936. !   v &= rep->len == l;
  1937. !   v &= rep->sgn == s;
  1938. !   if (!v) error("invariant failure");
  1939. !   return v;
  1940.   }
  1941.   
  1942.   void Integer::error(const char* msg) const
  1943. --- 2395,2414 ----
  1944.   
  1945.   int Integer::OK() const
  1946.   {
  1947. !   if (rep != 0)
  1948. !     {
  1949. !       int l = rep->len;
  1950. !       int s = rep->sgn;
  1951. !       int v = l <= rep->sz || STATIC_IntRep(rep);    // length within bounds
  1952. !       v &= s == 0 || s == 1;        // legal sign
  1953. !       Icheck(rep);                  // and correctly adjusted
  1954. !       v &= rep->len == l;
  1955. !       v &= rep->sgn == s;
  1956. !       if (v)
  1957. !       return v;
  1958. !     }
  1959. !   error("invariant failure");
  1960. !   return 0;
  1961.   }
  1962.   
  1963.   void Integer::error(const char* msg) const
  1964. *** 1.1    1992/03/22 07:42:32
  1965. --- xobstack.cc    1992/06/03 14:00:13
  1966. ***************
  1967. *** 110,123 ****
  1968.       (*lib_error_handler)("Obstack", "invariant failure");
  1969.     return v;
  1970.   }
  1971. - #ifdef VMS
  1972. - #include "libgxx-io-ob.cc"
  1973. - // The reason that this needs to be included is that if the modules for libg++
  1974. - // are placed in a library, and libgxx-ob-io is in a seperate module, then
  1975. - // that module contains only two symbols -  the contstructor and destructor.
  1976. - // they are not called explicitly anywhere else, so that module is not linked
  1977. - // in, and the contstructor is not called.  Chaos ensues.
  1978. - #endif
  1979. --- 110,112 ----
  1980. *** 1.1    1992/03/22 07:42:32
  1981. --- xrationa.cc    1992/06/03 14:00:14
  1982. ***************
  1983. *** 23,30 ****
  1984.   #include <math.h>
  1985.   #include <values.h>
  1986.   #include <builtin.h>
  1987.   
  1988.   void Rational::error(const char* msg) const
  1989.   {
  1990.     (*lib_error_handler)("Rational", msg);
  1991. --- 23,30 ----
  1992.   #include <math.h>
  1993.   #include <values.h>
  1994.   #include <builtin.h>
  1995. + #include <float.h>
  1996.   
  1997.   void Rational::error(const char* msg) const
  1998.   {
  1999.     (*lib_error_handler)("Rational", msg);
  2000. ***************
  2001. *** 393,400 ****
  2002.   int Rational::OK() const
  2003.   {
  2004.     int v = num.OK() && den.OK(); // have valid num and denom
  2005. !   v &= sign(den) > 0;           // denominator positive;
  2006. !   v &=  ucompare(gcd(num, den), _Int_One) == 0; // relatively prime
  2007.     if (!v) error("invariant failure");
  2008.     return v;
  2009.   }
  2010. --- 393,415 ----
  2011.   int Rational::OK() const
  2012.   {
  2013.     int v = num.OK() && den.OK(); // have valid num and denom
  2014. !   if (v)
  2015. !     {
  2016. !       v &= sign(den) > 0;           // denominator positive;
  2017. !       v &=  ucompare(gcd(num, den), _Int_One) == 0; // relatively prime
  2018. !     }
  2019.     if (!v) error("invariant failure");
  2020.     return v;
  2021. + }
  2022. + int
  2023. + Rational::fits_in_float() const
  2024. + {
  2025. +     return FLT_MIN <= *this && *this <= FLT_MAX;
  2026. + }
  2027. + int
  2028. + Rational::fits_in_double() const
  2029. + {
  2030. +     return DBL_MIN <= *this && *this <= DBL_MAX;
  2031.   }
  2032. *** 1.1    1992/03/22 07:42:32
  2033. --- xrng.cc    1992/06/03 14:00:14
  2034. ***************
  2035. *** 22,34 ****
  2036.   #include <builtin.h>
  2037.   #include <xrng.h>
  2038.   
  2039. ! // these get initialized right in the ctors, but need default value in C++
  2040. ! // (even if trash, as here)
  2041. ! PrivateRNGSingleType PrivateRNGSingleTypeInit;
  2042. ! PrivateRNGDoubleType PrivateRNGDoubleTypeInit;
  2043. ! PrivateRNGSingleType RNG::singleMantissa = PrivateRNGSingleTypeInit;
  2044. ! PrivateRNGDoubleType RNG::doubleMantissa = PrivateRNGDoubleTypeInit;
  2045.   
  2046.   //
  2047.   //    The scale constant is 2^-31. It is used to scale a 31 bit
  2048. --- 22,30 ----
  2049.   #include <builtin.h>
  2050.   #include <xrng.h>
  2051.   
  2052. ! // These two static fields get initialized by RNG::RNG().
  2053. ! PrivateRNGSingleType RNG::singleMantissa;
  2054. ! PrivateRNGDoubleType RNG::doubleMantissa;
  2055.   
  2056.   //
  2057.   //    The scale constant is 2^-31. It is used to scale a 31 bit
  2058. *** 1.1    1992/03/22 07:42:32
  2059. --- xstring.cc    1992/06/03 14:00:15
  2060. ***************
  2061. *** 1206,1221 ****
  2062.       return s;
  2063.     }
  2064.   #else
  2065. !   if (!s.ipfx(0))
  2066.     {
  2067.       s.set(ios::failbit); // Redundant if using GNU iostreams.
  2068.       return s;
  2069.     }
  2070.   #endif
  2071. !   char ch;
  2072.     int i = 0;
  2073.     x.rep = Sresize(x.rep, 20);
  2074. !   while (s.get(ch))
  2075.     {
  2076.       if (isspace(ch))
  2077.         break;
  2078. --- 1206,1222 ----
  2079.       return s;
  2080.     }
  2081.   #else
  2082. !   if (!s.ipfx(0) || (!(s.flags() & ios::skipws) && !ws(s)))
  2083.     {
  2084.       s.set(ios::failbit); // Redundant if using GNU iostreams.
  2085.       return s;
  2086.     }
  2087.   #endif
  2088. !   int ch;
  2089.     int i = 0;
  2090.     x.rep = Sresize(x.rep, 20);
  2091. !   register streambuf *sb = s.rdbuf();
  2092. !   while ((ch = sb->sbumpc()) != EOF)
  2093.     {
  2094.       if (isspace(ch))
  2095.         break;
  2096. ***************
  2097. *** 1225,1231 ****
  2098.     }
  2099.     x.rep->s[i] = 0;
  2100.     x.rep->len = i;
  2101. !   if(i == 0) s.clear(_bad);
  2102.     return s;
  2103.   }
  2104.   
  2105. --- 1226,1233 ----
  2106.     }
  2107.     x.rep->s[i] = 0;
  2108.     x.rep->len = i;
  2109. !   if (i == 0) s.set(_fail);
  2110. !   if (ch == EOF) s.set(_eof);
  2111.     return s;
  2112.   }
  2113.   
  2114. ***************
  2115. *** 1239,1248 ****
  2116.     {
  2117.       return 0;
  2118.     }
  2119. !   char ch;
  2120.     int i = 0;
  2121.     x.rep = Sresize(x.rep, 80);
  2122. !   while (s.get(ch))
  2123.     {
  2124.       if (ch != terminator || !discard)
  2125.       {
  2126. --- 1241,1251 ----
  2127.     {
  2128.       return 0;
  2129.     }
  2130. !   int ch;
  2131.     int i = 0;
  2132.     x.rep = Sresize(x.rep, 80);
  2133. !   register streambuf *sb = s.rdbuf();
  2134. !   while ((ch = sb->sbumpc()) != EOF)
  2135.     {
  2136.       if (ch != terminator || !discard)
  2137.       {
  2138. ***************
  2139. *** 1255,1260 ****
  2140. --- 1258,1264 ----
  2141.     }
  2142.     x.rep->s[i] = 0;
  2143.     x.rep->len = i;
  2144. +   if (ch == EOF) s.set(_eof);
  2145.     return i;
  2146.   }
  2147.   
  2148. ***************
  2149. *** 1305,1315 ****
  2150.   
  2151.   int String::OK() const
  2152.   {
  2153. !   int v = rep != 0;             // have a rep
  2154. !   v &= rep->len <= rep->sz;     // string within bounds
  2155. !   v &= rep->s[rep->len] == 0;   // null-terminated
  2156. !   if (!v) error("invariant failure");
  2157. !   return v;
  2158.   }
  2159.   
  2160.   int SubString::OK() const
  2161. --- 1309,1319 ----
  2162.   
  2163.   int String::OK() const
  2164.   {
  2165. !   if (rep == 0             // don't have a rep
  2166. !     || rep->len > rep->sz     // string oustide bounds
  2167. !     || rep->s[rep->len] != 0)   // not null-terminated
  2168. !       error("invariant failure");
  2169. !   return 1;
  2170.   }
  2171.   
  2172.   int SubString::OK() const
  2173.